package com.job.client.common.utils;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/*
* 时间工具类
* */
public class DateTimeUtils {
    /*
    * 生成当前时间，格式：
    * */
    public static String createNowTime(){
        LocalDateTime now = LocalDateTime.now();
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        String formatDateTime = now.format(formatter);
        return formatDateTime;
    }
    public static String createNowTime(String Format){
        LocalDateTime now = LocalDateTime.now();
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern(Format);
        String formatDateTime = now.format(formatter);
        return formatDateTime;
    }
    public static String conversion(LocalDateTime dateTime) {
        // 格式化日期时间为 "yyyy-MM-dd HH:mm:ss" 格式
        return dateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
    }
}
